package util;

import javax.sql.DataSource;
import com.mchange.v2.c3p0.ComboPooledDataSource;

import java.sql.Connection;
import java.sql.SQLException;

public class DataSourceUtil {
    private static ComboPooledDataSource c3p0;


    public static DataSource getDataSource(){
        if (c3p0 == null) {
            c3p0=new ComboPooledDataSource();
        }
        return c3p0;
    }

    public static Connection getConnection() throws SQLException{
        return getDataSource().getConnection();
    }

}
